<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core" template="/template.xhtml">
	<ui:define name="css">
		<h:outputStylesheet library="css" name="estilo.css" />
	</ui:define>
	<ui:define name="title"> Bidman</ui:define>
	<ui:define name="conteudo">
		<h:form id="form">
		<p:growl id="growl" showDetail="true" sticky="true" autoUpdate="true" />
			<p:panel header="Listar Editais"
				style="font-size:22px;margin:auto;text-align: center;">				
				<p:dataTable var="_edital" value="#{editalController.editais}"
					style="margin:auto;font-size:12px;width:100%" id="table"
					styleClass="ui-corner-all" emptyMessage="Não Há Registros"
					rowKey="#{_edital.id}"
					rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row'}"
					rowIndexVar="rowIx">
					<p:column headerText="Título">
						<h:outputText value="#{_edital.titulo}" />
					</p:column>
					<p:column headerText="Local">
						<h:outputText value="#{_edital.local}" />
					</p:column>
					<p:column headerText="Produto">
						<h:outputText value="#{_edital.produtoServico.descricao}" />
					</p:column>
					<p:column headerText="Quantidade">
						<h:outputText value="#{_edital.quantidadeProduto}" />
					</p:column>
					<p:column headerText="Valor Máximo">
						<h:outputText value="#{_edital.valor_max}" />
					</p:column>
					<p:column headerText="Data de Inicio">
						<h:outputText value="#{_edital.getData_inicioFormatada()}" />
					</p:column>
					<p:column headerText="Data de Finalização">
						<h:outputText value="#{_edital.getData_fimFormatada()}" />
					</p:column>
					<p:column headerText="Opção" style="width:50px">
						<p:commandButton id="showDialogButton"
							icon="ui-icon ui-icon-pencil" title="Editar" ajax="false"
							action="#{editalController.editarEdital(_edital)}" />
						<p:commandButton icon="ui-icon ui-icon-closethick" update="table"
							oncomplete="editalDialog.show()" title="Remover"
							action="#{editalController.setEditalSelecionado(_edital)}">
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</p:panel>
			<p:dialog header="Remover Edital" widgetVar="editalDialog"
				resizable="false" id="editalDlg" showEffect="fade"
				hideEffect="explode" modal="true">
				<h:panelGrid id="display" columns="2" cellpadding="4"
					style="margin:0 auto;">
					<p:commandButton id="deleteButton"
						action="#{editalController.removerEdital}"
						oncomplete="editalDialog.hide()" update="@form" value="Deletar" />
					<p:commandButton id="cancelButton" onclick="editalDialog.hide()"
						value="Cancelar" />
				</h:panelGrid>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>